<script lang="ts" setup name="Son">
    import { ref, defineProps } from 'vue';

    let toy = ref('奥特曼');

    // defineProps(['car', 'sendToy']);
    defineProps<{ car: string, sendToy: (newToy: string) => void }>();
</script>

<template>
    <div class="son">
        <h2>子组件</h2>
        <p>玩具：{{ toy }}</p>
        <p>父亲给的车：{{ car }}</p>
        <button @click="sendToy(toy)">把玩具给父亲玩一会儿</button>
    </div>
</template>

<style scoped>
    .son {
        background-color: skyblue;
        border-radius: 10px;
        padding: 5px 10px;
    }
</style>